package com.projManage.service.model.impl;

import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.HtmlUtil;
import com.liferay.portal.model.impl.BaseModelImpl;

import com.liferay.portlet.expando.model.ExpandoBridge;
import com.liferay.portlet.expando.model.impl.ExpandoBridgeImpl;

import com.projManage.service.model.projManagedb;
import com.projManage.service.model.projManagedbSoap;

import java.io.Serializable;

import java.lang.reflect.Proxy;

import java.sql.Types;

import java.util.ArrayList;
import java.util.List;


/**
 * <a href="projManagedbModelImpl.java.html"><b><i>View Source</i></b></a>
 *
 * <p>
 * ServiceBuilder generated this class. Modifications in this class will be
 * overwritten the next time is generated.
 * </p>
 *
 * <p>
 * This class is a model that represents the <code>projManagedb</code> table
 * in the database.
 * </p>
 *
 * @author Brian Wing Shun Chan
 *
 * @see com.projManage.service.model.projManagedb
 * @see com.projManage.service.model.projManagedbModel
 * @see com.projManage.service.model.impl.projManagedbImpl
 *
 */
public class projManagedbModelImpl extends BaseModelImpl<projManagedb> {
    public static final String TABLE_NAME = "projManagedb";
    public static final Object[][] TABLE_COLUMNS = {
            { "id", new Integer(Types.BIGINT) },
            

            { "username", new Integer(Types.VARCHAR) },
            

            { "password", new Integer(Types.VARCHAR) },
            

            { "dpurl", new Integer(Types.VARCHAR) },
            

            { "login", new Integer(Types.BOOLEAN) },
            

            { "loginuser", new Integer(Types.VARCHAR) }
        };
    public static final String TABLE_SQL_CREATE = "create table projManagedb (id LONG not null primary key,username VARCHAR(75) null,password VARCHAR(75) null,dpurl VARCHAR(75) null,login BOOLEAN,loginuser VARCHAR(75) null)";
    public static final String TABLE_SQL_DROP = "drop table projManagedb";
    public static final String DATA_SOURCE = "liferayDataSource";
    public static final String SESSION_FACTORY = "liferaySessionFactory";
    public static final String TX_MANAGER = "liferayTransactionManager";
    public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
                "value.object.entity.cache.enabled.com.projManage.service.model.projManagedb"),
            true);
    public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
                "value.object.finder.cache.enabled.com.projManage.service.model.projManagedb"),
            true);
    public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.util.service.ServiceProps.get(
                "lock.expiration.time.com.projManage.service.model.projManagedb"));
    private long _id;
    private String _username;
    private String _password;
    private String _dpurl;
    private boolean _login;
    private String _loginuser;
    private transient ExpandoBridge _expandoBridge;

    public projManagedbModelImpl() {
    }

    public static projManagedb toModel(projManagedbSoap soapModel) {
        projManagedb model = new projManagedbImpl();

        model.setId(soapModel.getId());
        model.setUsername(soapModel.getUsername());
        model.setPassword(soapModel.getPassword());
        model.setDpurl(soapModel.getDpurl());
        model.setLogin(soapModel.getLogin());
        model.setLoginuser(soapModel.getLoginuser());

        return model;
    }

    public static List<projManagedb> toModels(projManagedbSoap[] soapModels) {
        List<projManagedb> models = new ArrayList<projManagedb>(soapModels.length);

        for (projManagedbSoap soapModel : soapModels) {
            models.add(toModel(soapModel));
        }

        return models;
    }

    public long getPrimaryKey() {
        return _id;
    }

    public void setPrimaryKey(long pk) {
        setId(pk);
    }

    public Serializable getPrimaryKeyObj() {
        return new Long(_id);
    }

    public long getId() {
        return _id;
    }

    public void setId(long id) {
        _id = id;
    }

    public String getUsername() {
        return GetterUtil.getString(_username);
    }

    public void setUsername(String username) {
        _username = username;
    }

    public String getPassword() {
        return GetterUtil.getString(_password);
    }

    public void setPassword(String password) {
        _password = password;
    }

    public String getDpurl() {
        return GetterUtil.getString(_dpurl);
    }

    public void setDpurl(String dpurl) {
        _dpurl = dpurl;
    }

    public boolean getLogin() {
        return _login;
    }

    public boolean isLogin() {
        return _login;
    }

    public void setLogin(boolean login) {
        _login = login;
    }

    public String getLoginuser() {
        return GetterUtil.getString(_loginuser);
    }

    public void setLoginuser(String loginuser) {
        _loginuser = loginuser;
    }

    public projManagedb toEscapedModel() {
        if (isEscapedModel()) {
            return (projManagedb) this;
        } else {
            projManagedb model = new projManagedbImpl();

            model.setNew(isNew());
            model.setEscapedModel(true);

            model.setId(getId());
            model.setUsername(HtmlUtil.escape(getUsername()));
            model.setPassword(HtmlUtil.escape(getPassword()));
            model.setDpurl(HtmlUtil.escape(getDpurl()));
            model.setLogin(getLogin());
            model.setLoginuser(HtmlUtil.escape(getLoginuser()));

            model = (projManagedb) Proxy.newProxyInstance(projManagedb.class.getClassLoader(),
                    new Class[] { projManagedb.class },
                    new ReadOnlyBeanHandler(model));

            return model;
        }
    }

    public ExpandoBridge getExpandoBridge() {
        if (_expandoBridge == null) {
            _expandoBridge = new ExpandoBridgeImpl(projManagedb.class.getName(),
                    getPrimaryKey());
        }

        return _expandoBridge;
    }

    public Object clone() {
        projManagedbImpl clone = new projManagedbImpl();

        clone.setId(getId());
        clone.setUsername(getUsername());
        clone.setPassword(getPassword());
        clone.setDpurl(getDpurl());
        clone.setLogin(getLogin());
        clone.setLoginuser(getLoginuser());

        return clone;
    }

    public int compareTo(projManagedb projManagedb) {
        long pk = projManagedb.getPrimaryKey();

        if (getPrimaryKey() < pk) {
            return -1;
        } else if (getPrimaryKey() > pk) {
            return 1;
        } else {
            return 0;
        }
    }

    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }

        projManagedb projManagedb = null;

        try {
            projManagedb = (projManagedb) obj;
        } catch (ClassCastException cce) {
            return false;
        }

        long pk = projManagedb.getPrimaryKey();

        if (getPrimaryKey() == pk) {
            return true;
        } else {
            return false;
        }
    }

    public int hashCode() {
        return (int) getPrimaryKey();
    }

    public String toString() {
        StringBuilder sb = new StringBuilder();

        sb.append("{id=");
        sb.append(getId());
        sb.append(", username=");
        sb.append(getUsername());
        sb.append(", password=");
        sb.append(getPassword());
        sb.append(", dpurl=");
        sb.append(getDpurl());
        sb.append(", login=");
        sb.append(getLogin());
        sb.append(", loginuser=");
        sb.append(getLoginuser());
        sb.append("}");

        return sb.toString();
    }

    public String toXmlString() {
        StringBuilder sb = new StringBuilder();

        sb.append("<model><model-name>");
        sb.append("com.projManage.service.model.projManagedb");
        sb.append("</model-name>");

        sb.append(
            "<column><column-name>id</column-name><column-value><![CDATA[");
        sb.append(getId());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>username</column-name><column-value><![CDATA[");
        sb.append(getUsername());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>password</column-name><column-value><![CDATA[");
        sb.append(getPassword());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>dpurl</column-name><column-value><![CDATA[");
        sb.append(getDpurl());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>login</column-name><column-value><![CDATA[");
        sb.append(getLogin());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>loginuser</column-name><column-value><![CDATA[");
        sb.append(getLoginuser());
        sb.append("]]></column-value></column>");

        sb.append("</model>");

        return sb.toString();
    }
}
